<%--
  Created by IntelliJ IDEA.
  User: 刘邓
  Date: 2023-06-10
  Time: 9:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>添加名片</title>
  <style>
    .container {
      background-color: #fff;
      border-radius: 10px;
      box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);
      position: relative;
      overflow: hidden;
      width: 768px;
      max-width: 100%;
      min-height: 480px;
      margin:0 auto;
    }
    .container div{
      margin-top: 20px;
      margin-left: 40%;
    }

    input {
      background-color: #eee;
      border: none;
      padding: 12px 15px;
      margin: 8px 10px;
    }
  </style>
</head>
<body>
<form action="/home/addCardOutcome.jsp" class="container">
 <div> 姓名:<input type="text" name="name" id="r_name"></div>
  <div>性别:<input type="radio" name="sex" value="0" checked>男 &nbsp<input type="radio" name="sex" value="1">女</div>
  <div>账号:<input type="text" name="account" id="r_account"></div>
  <div>密码:<input type="password" name="password" id="r_pwd"></div>
  <div>确认密码:<input type="password" name="repassword" id="r_rpwd"></div>
  <div>邮箱:<input type="text" name="email" id="r_email"></div>
  <div style="padding-left: 30px"><input type="submit" value="添加" id="toAdd"></div>
</form>
</body>
<script>
  let toAdd = document.getElementById("toAdd");
  toAdd.addEventListener("click",()=>{
    let name_str=document.getElementById("r_name").value;
    if(name_str===null||name_str===""){
      alert("请输入姓名");
      location.reload();
      return;
    }
    let account_str=document.getElementById("r_account").value;
    if(account_str===null||account_str===""){
      alert("请输入账号");
      location.reload();
      return;
    }
    let pwd_str=document.getElementById("r_pwd").value;
    if(pwd_str===null||pwd_str===""){
      alert("请输入密码");
      location.reload();
      return;
    }
    let rpwd_str=document.getElementById("r_rpwd").value;
    if(rpwd_str===null||rpwd_str===""){
      alert("请输入确认密码");
      location.reload();
      return;
    }
    let email_str=document.getElementById("r_email").value;
    if(email_str===null||email_str===""){
      alert("请输入邮箱");
      location.reload();
      return;
    }
    if(rpwd_str !== pwd_str){
      alert("两次输入的密码不一致");
      location.reload();
      return;
    }
  })
</script>
</body>
</html>
